﻿<?php
    error_reporting(E_ALL); 
    require_once('config.php');     
    require_once('functions.php');
    require_once('logger.php');     
   // require_once('libs/nusoap.php');
   
   $data = array();
   
        $MOId = "12354454";
        $Telco="viettel";
        $ServiceNum="8055";
        $Phone="84974838181";
        $MsgType="0";
        $Title="";
        $Content="Da nhap 15k";
        $Charging="1";
        $RequestId="2";
        $privateKey="wIOsFEeLoNc6mOf";
                                                         
        $data["MOId"] =$MOId;
        $data["Telco"] = $Telco;            
        $data["ServiceNum"] = $ServiceNum; 
        $data["Phone"] = $Phone;
        $data["MsgType"] =$MsgType; 
        $data["Title"] =$Title;                      
        $data["Content"] =$Content;                      
        $data["Charging"] =$Charging;                      
        $data["RequestId"] =$RequestId;
        
       // echo $MOId.$Telco.$ServiceNum.$Phone.$MsgType.$Title.$Content.$Charging.$RequestId.$privateKey."<br>";
        $token =  MD5($MOId.$Telco.$ServiceNum.$Phone.$MsgType.$Title.$Content.$Charging.$RequestId.$privateKey);
        
        
        echo $token."<br/>";
        
       $data["Token"] =$token;                                           
             
           
   /*    $client = new SoapClient("http://mtop.vn/kkt_service/mTopSMSReceiveMTMe.php?wsdl");
        $result =  $client->__call("receiveMT", $data);     
        echo $result;   
*/
     
   /*  
  $soapClient =  new SoapClient(
    'http://service.10h.vn:8080/services/ReceiverMT?wsdl',
    array(
        // Stuff for development.
        'trace' => 1,
        'exceptions' => true,
        'cache_wsdl' => WSDL_CACHE_NONE,
        'features' => SOAP_SINGLE_ELEMENT_ARRAYS,

        // Auth credentials for the SOAP request.
        'login' => 'wsvintelcom',
        'password' => 'wsvintelcom!@#',

        // Proxy url.
        'proxy_host' => 'service.10h.vn', // Do not add the schema here (http or https). It won't work.
        'proxy_port' => 8080,

        // Auth credentials for the proxy.
        'proxy_login' => NULL,
        'proxy_password' => NULL,
    )
); */

/*
*- String serviceId: Đầu số dịch vụ.
- String userId: Số điện thoai người dùng.
- String providerId: Mã dịch vụ.
- String info: Nội dung MT
- String requestId: MoID (requestId)
- String operator: telco (VIETEL,VMS,GPC,SFONE,HTC,VMB)
- String msgType: 1 = Tính cước. 0 = Không tính cước.
- String contentType: 0 = Text. 
* 
*/
// var_dump($soapClient);
 
 /*    $data2 = array();
     $data2["serviceId"] ="8055";
     $data2["userId"] ="84974838181";
     $data2["providerId"] ="TCLIP";
     $data2["info"] ="Chuc ban xem clip vui ve.";
     $data2["requestId"] ="123";
     $data2["operator"] ="VIETEL";
     $data2["msgType"] ="1";
     $data2["contentType"] ="0";
     
   // $result =  $soapClient->__call("mtReceiver", $data2);     
   //var_dump($result);
   echo sendMToGateWay( $data2["serviceId"],$data2["userId"], $data2["providerId"],$data2["info"],$data2["requestId"],$data2["operator"], $data2["msgType"],  $data2["contentType"]);
     // Get MT From 
   /*  
     $moid ="1";
     $src = "84974838181"; //Số ĐT của người gửi (user)
     $dest ="8055";
     $cmdcode = "MTPDTD";
     $msgbody ="MTPDTD 1 123"; //Mã command dịch vụ (lưu ý đổi các ký tự <space> thành '+')
     $username = "tritueviet_8x55";
     $password ="Xz649Bvw";
     $urlVivo = "http://42.117.1.172/8x55_ttv.php?moid=".$moid."&src=".$src."&dest=".$dest."&cmdcode=".$cmdcode."&msgbody=".$msgbody."&username=".$username."&password=".$password;
     $opts = array(
      'http'=>array(
        'method'=>"GET",
        'header'=>"Accept-language: en\r\n" .
                  "Cookie: foo=bar\r\n"
      )
    );
    $context = stream_context_create($opts);
    // Open the file using the HTTP headers set above
    $file = file_get_contents($urlVivo, false, $context);
    var_dump($file);
    
    
    $a = 2;
 function convert1($a){
  $a *= -1;
  return $a;
 }
 $b = convert1($a);
 echo "Gia tri hien tai cua bien a la {$a} <br />";
 echo "Gia tri hien tai cua bien b la {$b} <br />";
 
 function convert2(&$a){
  $a *= -1;
  return $a;
 }
 $c = convert2($a);
 echo "Gia tri hien tai cua bien a la {$a} <br />";
 echo "Gia tri hien tai cua bien c la {$c} <br />";
*/
?>
